<template>
  <div class="head">
    <div class="tit" @click="tab">
      <button id="1" :class="id === '1' ? 'active' : ''" class="tex1">
        网点综合费用结算
      </button>
      <button id="2" :class="id === '2' ? 'active' : ''" class="tex1">
        网点出港费用结算
      </button>
      <button id="3" :class="id === '3' ? 'active' : ''" class="tex1">
        网点进港费用结算
      </button>
    </div>
    <div class="line" />
    <el-row>
      <el-col :span="24">
        <div v-if="id === '1'" class="title1">
          <el-form
            ref="form"
            style="
              display: flex;
              flex-wrap: wrap;
              margin-top: 24px;
              justify-content: space-between;
            "
            :model="form"
            label-width="80px"
          >
            <div
              style="
                display: flex;
                justify-content: space-between;
                width: 1210px;
                flex-wrap: wrap;
              "
            >
              <el-form-item class="text" label="网点名称">
                <el-select
                  class="input"
                  placeholder="请选择"
                  style="width: 286px"
                  @change="provinceChange"
                >
                  <el-option
                    v-for="item in ProvinceList"
                    :key="item.id"
                    :label="item.province"
                    :value="{ pid: item.pid, province: item.province }"
                  />
                </el-select>
              </el-form-item>
              <el-form-item class="text" label="政策类型">
                <el-select
                  class="input"
                  placeholder="请选择"
                  style="width: 286px"
                  @change="provinceChange"
                >
                  <el-option
                    v-for="item in ProvinceList"
                    :key="item.id"
                    :label="item.province"
                    :value="{ pid: item.pid, province: item.province }"
                  />
                </el-select>
              </el-form-item>
              <el-form-item class="text" label="展示层级">
                <el-select
                  class="input"
                  placeholder="请选择"
                  style="width: 286px"
                  @change="provinceChange"
                >
                  <el-option
                    v-for="item in ProvinceList"
                    :key="item.id"
                    :label="item.province"
                    :value="{ pid: item.pid, province: item.province }"
                  />
                </el-select>
              </el-form-item>
            </div>
            <div>
              <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
                <el-button>重置</el-button>
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div v-if="id === '1'" class="title1">
          <el-form
            ref="form"
            style="
              display: flex;
              justify-content: space-between;
              flex-wrap: wrap;
            "
            :model="form"
            label-width="80px"
          >
            <!-- <div style="display: flex;justify-content: space-around;flex-wrap: wrap;"> -->
            <el-form-item style="margin-left: 0" class="text" label="时间">
              <el-date-picker
                v-model="value"
                type="daterange"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                style="width: 708px"
              />
            </el-form-item>
            <div>
              <el-form-item>
                <el-button><i class="el-icon-upload2" />导出</el-button>
                <el-button>查看说明</el-button>
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div v-if="id === '2'" class="title1">
          <el-form
            ref="form"
            style="
              display: flex;
              flex-wrap: wrap;
              margin-top: 24px;
              justify-content: space-between;
            "
            :model="form"
            label-width="80px"
          >
            <div
              style="
                display: flex;
                justify-content: space-between;
                width: 1210px;
                flex-wrap: wrap;
              "
            >
              <el-form-item class="text" label="网点名称">
                <el-select
                  class="input"
                  placeholder="请选择"
                  style="width: 286px"
                  @change="provinceChange"
                >
                  <el-option
                    v-for="item in ProvinceList"
                    :key="item.id"
                    :label="item.province"
                    :value="{ pid: item.pid, province: item.province }"
                  />
                </el-select>
              </el-form-item>
              <el-form-item style="margin-left: 0" class="text" label="时间">
                <el-date-picker
                  v-model="value"
                  type="daterange"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  :default-time="['00:00:00', '23:59:59']"
                  style="width: 708px"
                />
              </el-form-item>
            </div>
            <div>
              <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
                <el-button>重置</el-button>
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div v-if="id === '2'" class="title1">
          <el-form
            ref="form"
            style="text-align: right"
            :model="form"
            label-width="80px"
          >
            <div>
              <el-form-item>
                <el-button @click="onSubmit"
                  ><i class="el-icon-upload2" />导出</el-button
                >
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div v-if="id === '3'" class="title1">
          <el-form
            ref="form"
            style="
              display: flex;
              flex-wrap: wrap;
              margin-top: 24px;
              justify-content: space-between;
            "
            :model="form"
            label-width="80px"
          >
            <div
              style="
                display: flex;
                justify-content: space-between;
                width: 1210px;
                flex-wrap: wrap;
              "
            >
              <el-form-item class="text" label="网点名称">
                <el-select
                  class="input"
                  placeholder="请选择"
                  style="width: 286px"
                  @change="provinceChange"
                >
                  <el-option
                    v-for="item in ProvinceList"
                    :key="item.id"
                    :label="item.province"
                    :value="{ pid: item.pid, province: item.province }"
                  />
                </el-select>
              </el-form-item>
              <el-form-item style="margin-left: 0" class="text" label="时间">
                <el-date-picker
                  v-model="value"
                  type="daterange"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  :default-time="['00:00:00', '23:59:59']"
                  style="width: 708px"
                />
              </el-form-item>
            </div>
            <div>
              <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
                <el-button>重置</el-button>
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div v-if="id === '3'" class="title1">
          <el-form
            ref="form"
            style="text-align: right"
            :model="form"
            label-width="80px"
          >
            <div>
              <el-form-item>
                <el-button @click="onSubmit"
                  ><i class="el-icon-upload2" />导出</el-button
                >
              </el-form-item>
            </div>
          </el-form>
        </div>
        <el-table
          v-if="id === '1'"
          max-height="550"
          :data="tableData"
          border
          :header-cell-style="{ background: '#f6f6f6' }"
          style="width: 100%"
        >
          <el-table-column prop="date" label="" width="180" align="center" />
          <el-table-column prop="address" label="日期" align="center" />
          <el-table-column prop="address" label="省份" align="center" />
          <el-table-column prop="address" label="网点编号" align="center" />
          <el-table-column prop="address" label="网点名称" align="center" />
          <el-table-column
            prop="name"
            label="寄件量"
            width="180"
            align="center"
          />
          <el-table-column prop="address" align="center" label="派件量" />
          <el-table-column prop="address" label="指标" align="center" />
          <el-table-column prop="address" align="center" label="出港结算金额" />
          <el-table-column prop="address" label="进港结算金额" align="center" />
        </el-table>
        <el-table
          v-if="id === '2'"
          :data="tableData"
          border
          max-height="550"
          :header-cell-style="{ background: '#f6f6f6' }"
          style="width: 100%"
        >
          <el-table-column prop="date" label="" width="180" align="center" />
          <el-table-column
            prop="name"
            label="日期"
            width="180"
            align="center"
          />
          <el-table-column prop="address" label="省份" align="center" />
          <el-table-column prop="address" label="网点编号" align="center" />
          <el-table-column prop="address" label="网点名称" align="center" />
          <el-table-column prop="address" align="center" label="重量级" />
          <el-table-column
            prop="address"
            width="140"
            label="累计重量段件量"
            align="center"
          />
          <el-table-column prop="address" align="center" label="基数" />
          <el-table-column
            prop="address"
            width="140"
            label="累计票件量"
            align="center"
          />
          <el-table-column
            prop="address"
            width="140"
            label="累计票件量占比"
            align="center"
          />
          <el-table-column
            prop="address"
            width="140"
            label="累计剔除票件量"
            align="center"
          />
          <el-table-column
            width="140"
            prop="address"
            label="出港结算金额"
            align="center"
          />
          <el-table-column
            prop="address"
            width="140"
            label="当日结算票件量"
            align="center"
          />
          <el-table-column
            prop="address"
            width="140"
            label="当日结算金额"
            align="center"
          />
          <el-table-column
            prop="address"
            width="140"
            label="当日剔除票件量"
            align="center"
          />
          <el-table-column
            prop="address"
            label="当日总件量"
            width="140"
            align="center"
          />
        </el-table>
        <el-table
          v-if="id === '3'"
          :data="tableData"
          border
          max-height="550"
          :header-cell-style="{ background: '#f6f6f6' }"
          style="width: 100%"
        >
          <el-table-column prop="date" label="" width="180" align="center" />
          <el-table-column
            prop="name"
            label="日期"
            width="180"
            align="center"
          />
          <el-table-column prop="address" label="省份" align="center" />
          <el-table-column prop="address" label="网点编号" align="center" />
          <el-table-column prop="address" label="网点名称" align="center" />
          <el-table-column prop="address" align="center" label="重量级" />
          <el-table-column prop="address" label="基数" align="center" />
          <el-table-column
            prop="address"
            align="center"
            label="累计重量段票件量"
            width="140"
          />
          <el-table-column
            prop="address"
            width="140"
            label="累计剔除票件量"
            align="center"
          />
          <el-table-column
            prop="address"
            width="140"
            label="累计结算票件量"
            align="center"
          />
          <el-table-column
            prop="address"
            width="140"
            label="进港结算金额"
            align="center"
          />
          <el-table-column
            prop="address"
            width="140"
            label="当日结算票件量"
            align="center"
          />
          <el-table-column
            prop="address"
            width="140"
            label="当日结算金额"
            align="center"
          />
          <el-table-column
            prop="address"
            width="140"
            label="当日剔除票件量"
            align="center"
          />
          <el-table-column prop="address" label="当日总件量" align="center" />
        </el-table>
        <div
          style="
            display: flex;
            justify-content: space-between;
            margin-top: 51px;
          "
        >
          <div class="title2">显示2到2，共2记录</div>
          <div class="block" style="display: flex; justify-content: flex-end">
            <el-pagination
              background
              :current-page="currentPage4"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="10"
              layout="prev, pager, next,sizes"
              :total="khTotal"
              prev-text="上一页"
              next-text="下一页"
              @size-change="khHandleSizeChange"
              @current-change="khHandleCurrentChange"
            />
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { getCityId, getProvinceList } from "@/api/dashboard";

export default {
  components: {},
  data() {
    return {
      id: "1",
      ProvinceList: [], // 省
      cityList: [], // 市
      value: "",
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
      },
      mxForm: {
        destinationProvince: "",
        destinationCity: "",
      },
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
      ],
    };
  },

  computed: {},

  created() {
    this.getProvince();
  },

  methods: {
    // tab切换
    tab(e) {
      this.id = e.target.id;
    },
    // 获取省
    getProvince() {
      getProvinceList().then((res) => {
        if (res.code === 200) {
          this.ProvinceList = res.data;
        }
      });
    },
    // 获取省的id
    provinceChange(value) {
      console.log(value);
      this.mxForm.destinationProvince = value.province;
      this.getCity(value.pid);
    },
    getCity(pid) {
      getCityId(pid).then((res) => {
        if (res.code === 200) {
          this.cityList = res.data;
        }
      });
    },
  },
};
</script>
<style scoped lang="scss">
.tit {
  display: flex;
  .tex1 {
    margin-right: 48px;
    font-size: 16px;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #666666;
    background: #fff;
    border: 1px #fff solid;
  }
  .active {
    font-family: Source Han Sans CN;
    font-weight: 700;
    color: #2087d0;
    position: relative;
  }
  .active::before {
    position: absolute;
    content: "";
    width: 126px;
    height: 2px;
    background: #2087d0;
    border-radius: 1px;
    bottom: -21px;
    left: 49%;
    transform: translate(-50%);
  }
}
.head {
  padding: 30px;
}
.title {
  font-size: 16px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #666666;
  margin-top: 20px;
}
.line {
  height: 1px;
  background: #d8d8d8;
  border-radius: 1px;
  margin-top: 19px;
}
.title1 {
  // display: flex;
  // justify-content: space-between;
  .text {
    font-size: 18px;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #666666;
    // margin-left: 52px;
    .input {
      width: 286px;
      height: 36px;
      background: #ffffff;
      // border: 1px solid #B4B4B4;
      border-radius: 4px;
    }
    .input1 {
      width: 708px;
      height: 36px;
      background: #ffffff;
      border: 1px solid #b4b4b4;
      border-radius: 4px;
    }
  }
}
.title2 {
  font-size: 18px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #666666;
}
</style>
